package offer;
//数值的整数次方
public class T12 {
    public double Power(double base, int exponent) {

        double ans  = 1 ;
        if (base<0) {
            base=-base;
            ans = -1;
        }
        if (exponent<0) {
            exponent=-exponent;
            base = 1.00000/base;
        }
        while (exponent>0) {
            if ((exponent&1)==1) ans *= base;
            base*=base;
            exponent>>=1;
        }
        return ans;
    }
    public static void main ( String[] args) {

        System.out.println(new T12().Power(2,-3));
    }
}
